/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.platformservice.persistence.project;

import org.proteusframework.core.api.IPlatformDelegate;
import org.proteusframework.core.api.model.INamespace;
import org.proteusframework.platformservice.persistence.api.IProjectDescriptor;
import org.proteusframework.platformservice.persistence.api.IProjectManagerVisitor;
import org.proteusframework.platformservice.persistence.api.IProjectManager;

import java.beans.PropertyChangeListener;
import java.util.List;

public final class NullProjectManager implements IProjectManager
{
    private static final String UNSUPPORTED_OP_MSG = "NullProjectManager does not support project management operations";

    @Override
    public boolean supportsProjectManagement()
    {
        return false;
    }

    @Override
    public void addPropertyChangeListener(PropertyChangeListener projectPropertiesListener)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void removePropertyChangeListener(PropertyChangeListener projectPropertiesListener)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void setCurrentProjectDescription(String description)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void setCurrentProjectProperty(String propertyGroup, String key, String value)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void create(IProjectDescriptor descriptor) throws ProjectInitializationException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void open(IProjectDescriptor descriptor) throws NoSuchProjectException, ProjectInitializationException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void delete(IProjectDescriptor descriptor) throws NoSuchProjectException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public IProjectDescriptor getCurrentProject()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public boolean isProjectOpen()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void save()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void saveAs(IProjectDescriptor descriptor) throws ProjectInitializationException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void close()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public List<IProjectDescriptor> listProjects()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public IProjectDescriptor getLastOpenedProject() throws NoSuchProjectException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public void clearLastOpenedProjectPath()
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public boolean doesProjectExist(INamespace namespace)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public IProjectDescriptor loadProjectDescriptor(INamespace namespace) throws NoSuchProjectException
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public boolean isValidProjectName(String projectName)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }

    @Override
    public <T extends IPlatformDelegate> void setPlatformDelegate(IPlatformDelegate delegate, Class<T> delegateInterface)
    {
        // Ignore
    }

    @Override
    public void accept(IProjectManagerVisitor visitor)
    {
        throw new UnsupportedOperationException(UNSUPPORTED_OP_MSG);
    }
}
